package cn.ldj.ztomcat;


import cn.ldj.ztomcat.catalina.Server;
import cn.ldj.ztomcat.classloader.CommonClassLoader;

import java.lang.reflect.Method;

public class Bootstrap {


    public static void main(String[] args) throws Exception {
//        Server server = new Server();
//        server.start();
        CommonClassLoader commonClassLoader = new CommonClassLoader();

        Thread.currentThread().setContextClassLoader(commonClassLoader);

        String serverClassName = "cn.ldj.ztomcat.catalina.Server";

        Class<?> serverClazz = commonClassLoader.loadClass(serverClassName);

        Object serverObject = serverClazz.newInstance();

        Method m = serverClazz.getMethod("start");

        m.invoke(serverObject);

        System.out.println("server的类加载器为="+serverClazz.getClassLoader());

    }


}
